import { randomRangeInt } from "cc";
import { GameManager } from "../../scripts/GameManager";
import { PalBattleEnemy, PalBattleEnemyOriginData } from "../../scripts/PalBattleSystem";
import { EnemyEnum } from "./EnemyEnum";
import { UiManager } from "../../scripts/UiManager";

export const enemy_001_草妖: PalBattleEnemyOriginData = {
    enemyID: EnemyEnum.草妖,
    name: '草妖',
    hp: 50,
    灵力: 0,
    武术: 19,
    防御: 0,
    身法: 0,
    吉运: 0,
    ai: (args: { enemy: PalBattleEnemy }) => {
        const gameManager = (GameManager.instance as GameManager);
        const uiManager = (UiManager.instance as UiManager);
        const system = gameManager.palBattleSystem;
        if (system.getEnemyDie(args.enemy.saveData.UUID)) return;

        const randomHero = system.getRandomHero();
        const targetNode = uiManager.getHeroNode(randomHero.saveData.UUID);

        const rand = randomRangeInt(0, 99);
        // if (rand < 50) {
        // 普通攻击
        gameManager.enemyAttackHero(args.enemy.saveData.UUID, randomHero.saveData.UUID, system.getEnemyAtk(args.enemy.saveData.UUID));
        // } else {
        //     // 释放技能

        // }
    }
}